<%@ page import="java.util.List" %>

<%@ taglib uri="/WEB-INF/bpmapp.tld" prefix="ssp" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<% String ctPath = request.getContextPath(); %>
<jsp:useBean id="docInfoView" scope="request" type="com.broadvision.web.util.ViewDynaBean"/> 

<script language="JavaScript">
  function doCheckout(theForm,cntOID,version){
     var fromLink = '<bean:write name="docInfoView" property="fromLocation" />';
     var theURL="/contentCheckout.do?contentOID="+cntOID+"&version="+version+"&fromLink="+fromLink; 
     theForm.action='<html:rewrite page="'+theURL+'" />';
     theForm.method = "post";
     theForm.submit();
     return false;
   }
   function doDelete(theForm,cntOID,version){
     if (confirm('<bean:message bundle="appCommonRes" key="bp.contentservice.confirm.delete"/>'))
     {
     var fromLink = '<bean:write name="docInfoView" property="fromLocation" />';
     var theURL="/contentDelete.do?contentOID="+cntOID+"&version="+version+"&fromLink="+fromLink; 
     theForm.action='<html:rewrite page="'+theURL+'" />';
     theForm.method = "post";
     theForm.submit();
     return false;
     }
   }
   function doUncheckout(theForm,cntOID,version){
     var fromLink = '<bean:write name="docInfoView" property="fromLocation" />';
     var theURL="/contentUncheckout.do?contentOID="+cntOID+"&version="+version+"&fromLink="+fromLink; 
     theForm.action='<html:rewrite page="'+theURL+'" />';
     theForm.method = "post";
     theForm.submit();
     return false;
   }
   function doReview(theForm,cntOID,version){
     var theURL="/contentReview.do?contentOID="+cntOID+"&version="+version; 
     theForm.action='<html:rewrite page="'+theURL+'" />';
     theForm.method = "post";
     theForm.submit();
     return false;
   }


function onVersionsDocument(theForm) {

  var theURL = '/ca/versionsDoc.do?guid=' + '<bean:write name="docInfoView" property="guid"/>';
  theForm.action = '<html:rewrite page="'+theURL+'" />';
  theForm.method = "post";
  theForm.submit();
  return false;
}

function onViewDocument(theForm) {

  var theURL = '/ca/viewDoc.do?action=View&guid=' + '<bean:write name="docInfoView" property="guid"/>';
  theURL += '&version=' + '<bean:write name="docInfoView" property="version"/>';
  theForm.action = '<html:rewrite page="'+theURL+'" />';
  theForm.method = "post";
  theForm.submit();
  return false;
}


function onEditDocument(theForm) {

  var theURL = '/ca/viewDoc.do?action=Edit&guid=' + '<bean:write name="docInfoView" property="guid"/>';
  theURL += '&version=' + '<bean:write name="docInfoView" property="version"/>';
  theForm.action = '<html:rewrite page="'+theURL+'" />';
  theForm.method = "post";
  theForm.submit();
  return false;
}
</script>


<jsp:useBean id="bv_user_logged_in" scope="session" class="java.lang.String" />

<logic:equal name="bv_user_logged_in" value="true">



<table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0" summary="<bean:message bundle="appCommonRes" key="bp.docInfo.title"/>">
  <tr> 
  <td valign="top" width="100%">
		  
  <div class="pageTitle"><bean:message bundle="appCommonRes" key="bp.docInfo.title"/></div>
  <div class="pageSubtitle">
    <span class="left"><bean:message bundle="appCommonRes" key="bp.docInfo.subtitle"/></span>
    <span class="right">&nbsp;</span>
  </div> 
  
	<div class="blockWrap">
	         
  <table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0" summary="<bean:message bundle="appCommonRes" key="bp.docInfo.title"/>">
    <tr>
      <td valign="top" width="25%" class="label"><bean:message bundle="appCommonRes" key="bp.docInfo.name"/>:</td>
      <td valign="top" class="labelField" width="75%"><bean:write name="docInfoView" property="name"/></td>
    </tr>    
    <tr>
      <td valign="top" width="25%" class="label"><bean:message bundle="appCommonRes" key="bp.docInfo.version"/>:</td>
      <td valign="top" class="labelField" width="75%">
      <logic:equal name="docInfoView" property="version" value="-1">
        <bean:message bundle="appCommonRes" key="bp.content.workingCopy"/>
      </logic:equal>
      <logic:notEqual name="docInfoView" property="version" value="-1">
        <bean:write name="docInfoView" property="version"/>
        <logic:equal name="docInfoView" property="isCurrentVersion" value="true">
        (<bean:message bundle="appCommonRes" key="bp.content.currentRevision"/>)
        </logic:equal>
      </logic:notEqual>
      </td>
    </tr>  
    <tr>
      <td valign="top" width="25%" class="label"><bean:message bundle="appCommonRes" key="bp.docInfo.type"/>:</td>
      <td valign="top" class="labelField" width="75%"><bean:write name="docInfoView" property="type"/></td>
    </tr> 
    <tr>
      <td valign="top" width="25%" class="label"><bean:message bundle="appCommonRes" key="bp.docInfo.docType"/>:</td>
      <td valign="top" class="labelField" width="75%"><bean:write name="docInfoView" property="docType"/></td>
    </tr>
  </table>
  
  <div class="pageButtonWrap" align="right">
  <form>
    
    <input type="button"
      <logic:notEqual name="docInfoView" property="viewBtn" value="Y">
      class="disabledButton"
      </logic:notEqual>
      <logic:equal name="docInfoView" property="viewBtn" value="Y">
      class="titleButton"
      </logic:equal>
      name="viewButton"
      value='<bean:message bundle="appCommonRes" bundle="appCommonRes" key="button.view"/>' 
      onClick="return onViewDocument(this.form)" 
      <logic:notEqual name="docInfoView" property="viewBtn" value="Y">
      disabled</logic:notEqual>
      >
    
    
    <input type="button" 
      <logic:notEqual name="docInfoView" property="editBtn" value="Y">
      class="disabledButton"
      </logic:notEqual>
      <logic:equal name="docInfoView" property="editBtn" value="Y">
      class="titleButton"
      </logic:equal>
      name="editButton"
      value='<bean:message bundle="appCommonRes" bundle="appCommonRes" key="button.edit"/>' 
      onClick="return onEditDocument(this.form)" 
      <logic:notEqual name="docInfoView" property="editBtn" value="Y">
      disabled</logic:notEqual>
      >
    
    <input type="button" 
      <logic:notEqual name="docInfoView" property="checkoutBtn" value="Y">
      class="disabledButton"
      </logic:notEqual>
      <logic:equal name="docInfoView" property="checkoutBtn" value="Y">
      class="titleButton"
      </logic:equal>
      name="checkoutButton"
      value='<bean:message bundle="appCommonRes" bundle="appCommonRes" key="button.checkOut"/>' 
      onclick="return doCheckout(this.form,'<bean:write name="docInfoView" property="guid"/>','<bean:write name="docInfoView" property="version"/>')" 
      <logic:notEqual name="docInfoView" property="checkoutBtn" value="Y">
      disabled</logic:notEqual>
      > 
    
    
    <input type="button" 
      <logic:notEqual name="docInfoView" property="uncheckoutBtn" value="Y">
      class="disabledButton"
      </logic:notEqual>
      <logic:equal name="docInfoView" property="uncheckoutBtn" value="Y">
      class="titleButton"
      </logic:equal>
      name="uncheckoutButton"
      value='<bean:message bundle="appCommonRes" bundle="appCommonRes" key="button.uncheckOut"/>' 
      onclick="return doUncheckout(this.form,'<bean:write name="docInfoView" property="guid"/>','<bean:write name="docInfoView" property="version"/>')" 
      <logic:notEqual name="docInfoView" property="uncheckoutBtn" value="Y">
      disabled</logic:notEqual>
      > 
    
    
    <input type="button" 
      <logic:notEqual name="docInfoView" property="versionsBtn" value="Y">
      class="disabledButton"
      </logic:notEqual>
      <logic:equal name="docInfoView" property="versionsBtn" value="Y">
      class="titleButton"
      </logic:equal>
      name="versionsButton"
      value='<bean:message bundle="appCommonRes" bundle="appCommonRes" key="button.versions"/>' 
      onClick="return onVersionsDocument(this.form)" 
      <logic:notEqual name="docInfoView" property="versionsBtn" value="Y">
      disabled</logic:notEqual>
      >
    
    <input type="button" 
      <logic:notEqual name="docInfoView" property="deleteBtn" value="Y">
      class="disabledButton"
      </logic:notEqual>
      <logic:equal name="docInfoView" property="deleteBtn" value="Y">
      class="titleButton"
      </logic:equal>
      name="deleteButton"
      value='<bean:message bundle="appCommonRes" bundle="appCommonRes" key="button.delete"/>' 
      onclick="return doDelete(this.form,'<bean:write name="docInfoView" property="guid"/>','<bean:write name="docInfoView" property="version"/>')" 
      <logic:notEqual name="docInfoView" property="deleteBtn" value="Y">
      disabled</logic:notEqual>
      > 
    
    
    <input type="button" 
      <logic:notEqual name="docInfoView" property="reviewBtn" value="Y">
      class="disabledButton"
      </logic:notEqual>
      <logic:equal name="docInfoView" property="reviewBtn" value="Y">
      class="titleButton"
      </logic:equal>
      name="reviewButton"
      value='<bean:message bundle="appCommonRes" bundle="appCommonRes" key="button.review"/>' 
      onclick="return doReview(this.form,'<bean:write name="docInfoView" property="guid"/>','<bean:write name="docInfoView" property="version"/>')"  
      <logic:notEqual name="docInfoView" property="reviewBtn" value="Y">
      disabled</logic:notEqual>
      >
  </form>
  </div>
  
  </div>
  </td>
  </tr>
</table>

</logic:equal>
